from enthought.traits.api import HasTraits,Int,Float,Str,Property,Range,Array
from enthought.traits.ui.api import View,Item,Label
from enthought.chaco.chaco_plot_editor import ChacoPlotItem
from numpy import array,poly1d,arange,linspace

class WaterfallPlotter(HasTraits):
    '''Creates a waterfall plot from 2D datasets.'''

    # Creates some sample data for testing.
    slider = Range(0, 10)

    xdata = Array
    ydata = Property(depends_on="slider")

    # Sets default values.
    def _slider_default(self): return 0

    def _xdata_default(self): return linspace(0, 10, 10)

    def _get_ydata(self): return self.slider * self.xdata

    traits_view = View(
                ChacoPlotItem("xdata","ydata", y_bounds=(0, 100),
                               y_auto=False,resizable=True,show_label=False,
                               x_label="x",y_label="y",title=""),
                Item('slider'),
                resizable = True, 
                width=900, height=600,               
                title="Waterfall Plotter"               
                      )

if __name__ == "__main__":
    p = WaterfallPlotter()
    p.configure_traits()

